home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscDependency.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-14  |  1.4 KB  |  63 lines

  1. /*
  2.  
  3. File MiscDependency.h
  4.  
  5. Copyright (C) 1994 by H. Scott Roy
  6.  
  7.         H. Scott Roy
  8.         2573 Stowe Ct.
  9.         Northbrook, IL  60062-8103
  10.         iconkit@cs.stanford.edu
  11.  
  12. For your editing convenience, this file is best viewed using an editor that automatically wraps long lines, in a fixed point font at 80 columns, with tabs every 4 spaces.
  13.  
  14. */
  15.  
  16.  
  17. /* ========================================================================== */
  18.  
  19.  
  20. /*
  21.  
  22. There are two significant problems that crop up when objects can appear in an indefinite number of places:
  23.  
  24.     1.  How does one guarantee that changes propagate properly?
  25.     2.  How does memory management work?
  26.  
  27. The solution provided by the MiscDependency class is to have each object keep track of the objects that are using it.  That way an object can notify all its users when it changes, and it can free itself when it is no longer need.
  28.  
  29.     -WARNING-
  30.  
  31. Watch out for dependency loops!
  32.  
  33. */
  34.  
  35.  
  36. /* ========================================================================== */
  37.  
  38.  
  39. /*
  40.  
  41. The MiscDependency protocol is a public version of the IKDependency protocol from IconKit.  If IconKit is installed on your system, you may wish to fiddle with the #ifdef's below so that the IKDependency and MiscDependency protocols are recognized as identical.
  42.  
  43. */
  44.  
  45.  
  46. #if 1
  47.  
  48. @protocol MiscDependency
  49.  
  50. - addUser: who;
  51. - addListener: who;
  52. - removeUser: who;
  53. - removeListener: who;
  54.  
  55. @end
  56.  
  57. #else
  58.  
  59. #define MiscDependency    IKDependency
  60. #import "iconkit/IKDependency.h"
  61.  
  62. #endif
  63.